<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Pharmacy Admin</title>

    <!-- GLOBAL STYLES -->
    <link href="css/flex-admin/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic' rel="stylesheet" type="text/css">
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel="stylesheet" type="text/css">
    <link href="icons/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <!-- PAGE LEVEL PLUGIN STYLES -->

    <!-- THEME STYLES -->
    <link href="css/flex-admin/style.css" rel="stylesheet">
    <link href="css/flex-admin/plugins.css" rel="stylesheet">

    <!-- THEME DEMO STYLES -->
    <link href="css/flex-admin/demo.css" rel="stylesheet">
</head>
<body class="login">

    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-banner text-center">
                    <h1><i class="fa fa-gears"></i>Hệ thống quản lí quầy thuốc</h1>
                </div>
                <div class="portlet portlet-green">
                    <div class="portlet-heading login-heading">
                        <div class="portlet-title">
                            <h4><strong>Đăng nhập</strong>
                            </h4>
                        </div>
                        <div class="portlet-widgets">
                     <!--        <button class="btn btn-white btn-xs"><i class="fa fa-plus-circle"></i>Tài khoản mới</button> -->
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="portlet-body">
						<c:if test="${not empty error}">
							<div class="error">${error}</div>
						</c:if>
						<c:if test="${not empty msg}">
							<div class="msg">${msg}</div>
						</c:if>
						<form id="loginForm"
							action="<c:url value='/j_spring_security_check' />" method="POST"
							id="login" name='loginForm'>
							<fieldset>
								<div class="form-group">
									<input class="form-control" placeholder="Username" name="username" id="username"
										type="text" autocomplete="off">
								</div>
								<div class="form-group">
									<input class="form-control" placeholder="Password"
										name="password" type="password" value="" id="password" autocomplete="off" onKeyPress="return submitenter(this,event)">
								</div>
								<div class="checkbox">
									<label> <input name="remember" type="checkbox"
										value="Remember Me">Lưu mật khẩu
									</label>
								</div>
								<br> <button type="button" value="submit" onclick="changeValue()"
									class="btn btn-lg btn-green btn-block">Đăng nhập</button>
							</fieldset>
							<br>
							<p class="small">
								<a href="#">Quên mật khẩu?</a>
							</p>
							<input type="hidden" name="${_csrf.parameterName}"
								value="${_csrf.token}" />
						</form>
					</div>
                </div>
            </div>
        </div>
    </div>
    <!-- GLOBAL SCRIPTS -->

    <script src="js/jquery-2.1.0.min.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/flex-admin/plugins/bootstrap/bootstrap.min.js"></script>
    <script src="js/flex-admin/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <!-- HISRC Retina Images -->
    <script src="js/flex-admin/plugins/hisrc/hisrc.js"></script>

    <!-- PAGE LEVEL PLUGIN SCRIPTS -->

    <!-- THEME SCRIPTS -->
    <script src="js/flex-admin/flex.js"></script>
<script>
function changeValue(){
	var password = document.getElementById("password").value;
	document.getElementById("password").value=calcMD5(password);
	document.getElementById("loginForm").submit();
}
function submitenter(myfield,e)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13)
    {
    	changeValue();
        myfield.form.submit();
        return false;
    }
    else
        return true;
}

</script>
</body>
</html>